 <html>
   <head>
		<meta  charset = "utf-8">
		<title>上传图片</title>
		<script type="text/javascript" src="__PUBLIC__/js/jquery-1.8.2.min.js"></script> 
   </head>
   <body>
		<center>
		   
		     <h3>上传图片</h3>
			
		     <hr>  
			 <form action="{:U('index/uploadpic')}"  method="post" enctype="multipart/form-data" >
			<table  width = "300"  border = "1" cellspacing = "0"  >
			  
			   
			  
			   <tr>
					<td>图片</td>
					<td><input type="file" name="uploadImg" onchange="Javascript:validate_img(this);" size="12"/></td>
					
			   </tr>
			   <tr>
			      <td colspan = "2"  align = "center">
				     <input type = "submit" value = "上传">
				     <input type = "reset" value = "重置">
				  </td>
			   </tr>
			</table>
		</center>
		<script type="text/javascript"> 
		function validate_img(a){
		 var file = a.value;
		 if(!/.(gif|jpg|jpeg|png|GIF|JPG|png)$/.test(file)){
		  alert("图片类型必须是.gif,jpeg,jpg,png中的一种");
		  return false;
		}else{
			 var image = new Image();
			 image.src = file;
			 var height = image.height;
			 var width = image.width;
			
			  alert(image.src);
			 if(width>80 && height>80 && filesize>102400){
			  alert('请上传80*80像素 或者大小小于100k的图片');
			  return false;
			 }
		 }
		 alert("图片通过");
		}
		</script> 
   </body>
   
 </html>